package cn.gogpay.dcb.api;

import cn.gogpay.dcb.api.common.constant.BizConstant;
import cn.gogpay.dcb.springboot.config.JsonRespHandlerConfig;
import org.springframework.amqp.core.Queue;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

/**
 * 说明
 *
 * @author zhanglong@gogpay.cn
 * @date 2018/8/8 18:50
 */
@EnableDiscoveryClient
@EnableFeignClients
@EnableCaching
@SpringBootApplication
@EntityScan(basePackages = "cn.gogpay.dcb")
@EnableJpaRepositories(basePackages = "cn.gogpay.dcb")
@ComponentScan(basePackages = "cn.gogpay.dcb",
        excludeFilters = {@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = JsonRespHandlerConfig.class)})
@EnableJpaAuditing
@RefreshScope
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
    @Bean()
    Queue orderQueue() {
        return new Queue(BizConstant.ORDER_WRITER_OFF, false);
    }

    @Bean()
    Queue busWriteOffMQException() {
        return new Queue("BusWriteOffMQ", false);
    }
}
